#ifndef _ROATE_BITMAP_H_
#define _ROATE_BITMAP_H_
typedef unsigned long       DWORD;
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef long LONG;

typedef struct tagBITMAPFILEHEADER { 
	WORD bfType; //必须为'BM'
	DWORD bfSize; //文件大小
	WORD bfReserved1; //必须为0
	WORD bfReserved2; //必须为0
	DWORD bfOffBits;//从ITMAPFILEHEADER到存放bmp数据的偏移量
}BITMAPFILEHEADER, *PBITMAPFILEHEADER;

typedef struct tagBITMAPINFOHEADER{
	DWORD biSize; //此结构的大小,可用sizeof(BITMAPINFOHEAER)得到
	LONG  biWidth; //位图宽度,以象素为单位
	LONG  biHeight; //位图高度,以象素为单位
	WORD  biPlanes; //必须为1
	WORD  biBitCount;//位图象素位数,可为0,1,4,8,24,32 
	DWORD biCompression; 
	DWORD biSizeImage; //(仅用于压缩)
	LONG  biXPelsPerMeter; //一米横向象素数
	LONG  biYPelsPerMeter; //一米纵向象素数
	DWORD biClrUsed;// (非零用语短颜色表)
	DWORD biClrImportant; 
}BITMAPINFOHEADER, *PBITMAPINFOHEADER;

//位图颜色板 用于 16bpp 及以下位图， 之上不需要颜色板（调色板）
typedef struct tagRGBQUAD { // rgbq   
    BYTE    rgbBlue;   
    BYTE    rgbGreen;   
    BYTE    rgbRed;   
    BYTE    rgbReserved;   
} RGBQUAD;

void RoateBitmap(char *srcFileName, char *dstFileName);
void Roate8Bpp(LONG width, LONG height, unsigned char * srcData, unsigned char * dstData);
void Roate16Bpp(LONG width, LONG height, unsigned char * srcData, unsigned char * dstData);
void Roate24Bpp(LONG width, LONG height, unsigned char * srcData, unsigned char * dstData); 
//可以使用下面这个函数替代上面三个函数。
void RoateData(LONG width, LONG height, unsigned char * srcData, unsigned char * dstData, int Bpp);
#endif
